$(function(){
    init()
    function init(){
        getFirstClassification()
        getSecClassification()
        getThirdClass()
    }



    // 获取一级分类数据(后面要改接口-》因为之前写错了接口没改。而且也没有设置基准路径，以后要补回)
    function getFirstClassification(){
        $.get("http://result.eolinker.com/7zJY3TY720a898fe3ecd448b738f46b28c377498068c111?uri=/api.php/Home/Index/subcates",function(res){
            var ret = JSON.parse(res)
            // console.log(ret)
            var html = template("firstClass",{arr:ret.data})
            $("#nav ul").html(html)
        })
    }
    function getSecClassification(){
        $.get("http://result.eolinker.com/7zJY3TY720a898fe3ecd448b738f46b28c377498068c111?uri=/api.php/Home/Index/subcates",function(res){
            var ret = JSON.parse(res)
            // console.log(ret)
            var html = template("secClass",{arr:ret.data})
            $(".inner-c").html(html)
        })
    }
    // 三级菜单
    function getThirdClass(){
        $.get("http://result.eolinker.com/7zJY3TY720a898fe3ecd448b738f46b28c377498068c111?uri=/api.php/Home/Index/cateresource",function(res){
            var ret = JSON.parse(res)
            console.log(ret)
            var html = template("thirdClass",{arr:ret.data})
            $(".right").html(html)
        })
    }
})
